Skip to content

build(samples): Remove outputs.upToDateWhen { false } from systemTest tasks#5522

Open
runningcode wants to merge 2 commits into
mainfrom
no/remove-uptodatewhen-systemtest
Open

build(samples): Remove outputs.upToDateWhen { false } from systemTest tasks#5522
runningcode wants to merge 2 commits into
mainfrom
no/remove-uptodatewhen-systemtest

Conversation

@runningcode

@runningcode runningcode commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

📜 Description

Removes outputs.upToDateWhen { false } from the systemTest tasks in the sentry-samples/* modules, and replaces it with proper Gradle input tracking via a new io.sentry.systemtest convention plugin.

The system tests launch the packaged sample app (shadowJar/bootJar/war) from build/libs as a separate process — it is not on the test classpath. With only outputs.upToDateWhen { false } removed, Gradle would compute up-to-date purely from the test classes and runtime classpath, so a separate jar build could refresh the artifact while systemTest was skipped, meaning the assertions never ran against the rebuilt sample.

Rather than repeat the input wiring in all 22 sample build files, it lives in one build-logic convention plugin (build-logic/src/main/kotlin/io.sentry.systemtest.gradle.kts), following the existing io.sentry.spotless / io.sentry.javadoc pattern. The plugin auto-detects the packaging task with precedence war → shadowJar → bootJar (mirroring test/system-test-runner.py) and declares its archive as a systemTest input + dependency:

tasks.matching { it.name == "systemTest" }.configureEach {
  val archiveTask = when {
    tasks.findByName("war") != null -> "war"
    tasks.findByName("shadowJar") != null -> "shadowJar"
    tasks.findByName("bootJar") != null -> "bootJar"
    else -> null
  }
  if (archiveTask != null) {
    dependsOn(archiveTask)
    inputs.files(tasks.named(archiveTask))
      .withPropertyName("appArchive")
      .withNormalizer(ClasspathNormalizer::class.java)
  }
}

Each sample just applies id("io.sentry.systemtest"); the existing inline systemTest blocks are otherwise unchanged. configureEach defers the wiring until the task is realized (no afterEvaluate), at which point the packaging plugins are already applied.

💡 Motivation and Context

outputs.upToDateWhen { false } disabled up-to-date checks and build cache reuse for the systemTest tasks, because the launched JAR/WAR was not modeled as a task input. This models that input properly — in one place — instead of disabling incremental builds wholesale.

💚 How did you test it?

  • ./gradlew spotlessApply / spotlessCheck pass (the new plugin compiles and applies).
  • ./gradlew --dry-run :sentry-samples:<module>:systemTest for a console (shadowJar), Spring Boot 2 (shadowJar), Spring Boot 4 (bootJar), and Tomcat (war) module confirms the packaging task is now wired into the task graph ahead of systemTest.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

#skip-changelog

… tasks

The systemTest tasks in the sample modules forced Gradle to always treat
their outputs as out of date, disabling up-to-date checks and build cache
reuse. Removing this lets Gradle rely on its normal input/output tracking
for the Test tasks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sentry

sentry Bot commented Jun 10, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.43.1 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode runningcode marked this pull request as ready for review June 10, 2026 08:48

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 44084fa. Configure here.

Comment thread sentry-samples/sentry-samples-console/build.gradle.kts

@adinauer adinauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thanks! Approving so you can merge once the comment is addressed.

The system tests launch the packaged sample (war/shadowJar/bootJar) from
build/libs as a separate process, so the archive is a real input to the
systemTest task even though it is not on the test classpath. Without it,
removing outputs.upToDateWhen { false } would let Gradle mark systemTest
up-to-date while a separate jar build refreshed the artifact, skipping
verification against the rebuilt sample.

Move that wiring into a single io.sentry.systemtest convention plugin in
build-logic instead of repeating it in every sample build file. The
plugin auto-detects the packaging task (war, else shadowJar, else
bootJar), mirroring the selection in test/system-test-runner.py, and
declares its archive as an input and dependency. Each sample just
applies the plugin.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@runningcode runningcode force-pushed the no/remove-uptodatewhen-systemtest branch from b038dc1 to 9724cf1 Compare June 22, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants